//
//  YFGuideTableViewController.swift
//  微博
//
//  Created by 余仿 on 16/4/8.
//  Copyright © 2016年 YF. All rights reserved.
//

import UIKit

class YFGuideTableViewController: UITableViewController,YFGuideViewDelegate {


    var isLogIn = YFViewModel.sharedViewModels.userLogIn

    var guideView:YFGuideView?

    //MARK:根据是否登录选择对应的View
    override func loadView() {
        
        isLogIn ? super.loadView() : prepareForVisitorLoginView()

    }

    //MARK:加载未登录界面
    func prepareForVisitorLoginView(){

        guideView = YFGuideView()

        guideView?.delegate = self

        navigationItem.leftBarButtonItem  = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "logInBtnDidClick")

        navigationItem.rightBarButtonItem  = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "registerBtnDidClick")

        navigationController?.navigationBar.tintColor = UIColor.orangeColor()

        view = guideView
    }

    func logInBtnDidClick(){
        print("VC  登录")

        let nav =  UINavigationController(rootViewController: YFOauthViewController())

        presentViewController(nav, animated: true, completion: nil)
    }

    func registerBtnDidClick(){
        print("VC 注册")
    }

    override func viewDidLoad() {
        super.viewDidLoad()
    }



  }
